<?php
/**
 * @version		$Id: view.html.php 25 2010-09-08 15:16:11Z joomlaworks $
 * @package		K2mart
 * @author    JoomlaWorks http://www.joomlaworks.gr
 * @copyright	Copyright (c) 2006 - 2010 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved.
 * @license		Commercial - This code cannot be redistributed without permission from Nuevvo Webware Ltd.
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.view');

class K2martViewMigrator extends JView {

	function display($tpl = null) {
		JHTML::_('behavior.keepalive');
		JLoader::register('K2ModelCategories', JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'models'.DS.'categories.php');
		$categories = K2ModelCategories::categoriesTree(NULL, false, false);
		$options = array();
		$options[] = JHTML::_('select.optgroup', JText::_('Create New K2 category'));
		$options[] = JHTML::_('select.option', 0, JText::_('Type category name'));
		$options[] = JHTML::_('select.optgroup', JText::_('Use existing K2 category'));
		foreach($categories as $category){
			$options[] = JHTML::_('select.option', $category->value, $category->text);
		}
		
		
		$option = new JObject();
		$option->value = 0;
		$option->text = JText::_('None - Auto create the root category for me');
		array_unshift($categories, $option);
		$lists['category'] = JHTML::_('select.genericlist', $options, 'catid', 'class="inputbox"', 'value', 'text', 0);
		$this->assignRef('lists', $lists);
		$toolbar=&JToolBar::getInstance('toolbar');
		$toolbar->prependButton('Link', 'archive', 'Start import', JURI::base().'index.php?option=com_k2mart&amp;view=migrator&amp;task=import');
		JToolBarHelper::title(':: '.JText::_('Virtuemart Migrator'), 'k2mart.png');
		JToolBarHelper::cancel();
		JSubMenuHelper::addEntry(JText::_('Dashboard'), 'index.php?option=com_k2mart&view=dashboard');
		JSubMenuHelper::addEntry(JText::_('Settings'), 'index.php?option=com_k2mart&view=settings');
		JSubMenuHelper::addEntry(JText::_('Virtuemart Migrator'), 'index.php?option=com_k2mart&view=migrator', true);
		parent::display($tpl);
	}

}
